package chapter_27;

/**
 * 使用自定义注解
 */
@Marker
@MyAnnotation(description = "自定义注解")
public class Main {

    @MemberAnnotation(type = String.class, description = "姓名")
    private String name;

    @MemberAnnotation(type = int.class, description = "年龄")
    private int age;

    @MemberAnnotation(type = String.class, description = "获取姓名")
    public String getName() {
        return name;
    }

    @MemberAnnotation(type = String.class, description = "获取年龄")
    public int getAge() {
        return age;
    }

    @MemberAnnotation(description = "设置姓名和年龄")
    public void setNameAndAge(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person {" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
